include Makefile.inc

OBJ=main.o LogFactorialTable.o init.o
TARGET=LINUX
LIBFILES=libDatabase.a libSpectrum.a

SUBDIRS=Database Spectrum

LINKFLAGS=-L/usr/lib -L. -lxml2 -lgomp -lOpenCL  
CFLAGS+=-I/usr/include/libxml2
CFLAGS+=-IInclude
CFLAGS+=-I$(CLUTILDIR)
CFLAGS+=-I$(OPENCLINCLUDE)
LINKFLAGS+=-L$(CLUTILDIR) -lclUtil

specmaster: $(OBJ) $(LIBFILES)
	$(CC) -o specmaster $(OBJ) $(LIBFILES) $(LINKFLAGS)

subdirs: 
	for dir in $(SUBDIRS); do $(MAKE) -C Database; done

.cc.o:
	$(CC) -c $(CFLAGS) -o $@ $<

LogFactorialTable.cc: LogGen
	./LogGen > LogFactorialTable.cc
	rm LogGen

LogGen:
	g++ LogFactorialGen.cc -o LogGen
 
%.a: 
	$(MAKE) -C $(subst .a,,$(subst lib,,$@))

clean:
	for dir in $(SUBDIRS); do make -C $$dir clean; done
	rm *.o specmaster LogFactorialTable.cc
